<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>考试倒计时</title>
    <script type="text/javascript" src="js/jquery.min.js"></script>

    <link type="text/css" href="css/style.css" rel="stylesheet" />
    <style>
        .wrap {
            position: absolute;
            bottom: 0;
            top: 0;
            left: 0;
            right: 0;
            margin: auto;
            height: 310px;
        }
        .timeBox{
            width: 1200px;
            height: 50px;
            margin: 300px auto;
            overflow: hidden;
            text-align: center;
        }
        .timeBox li{
            float: left;
            width: 100px;
            height: 100px;
            border-radius: 5px;
            background: hsla(239,47%,31%,1.00);
            list-style: none;
            color: #FFFFFF;
            line-height: 52px;
            text-align: center;
            justify-content: center;
            font-size: 50px;
            margin: 0px 15px;
        }
    </style>
</head>

<body>
<script type="text/javascript" src="js/TweenMax.min.js"></script>
<div class = "wrap">
    <h1>考试 <strong>倒计时</strong></h1>
</div>
<ul class = "timeBox">
    <li id = "Day">00</li>
    <li>天</li>
    <li id = "Hour">00</li>
    <li>时</li>
    <li id = "Minute">00</li>
    <li>分</li>
    <li id = "Second">00</li>
    <li>秒</li>
</ul>
<script>
    window.onload = function (){
        countDown();
    }
    function countDown(){
        var now = new Date();
        var end = new Date("2022-12-20 00:00:00");
        var time = end.getTime()-now.getTime();
        if (time<=0){
            return false;
        }
        else {
            var D = parseInt(time/1000/60/60/24);
            var H = parseInt(time/1000/60/60%24);
            var M = parseInt(time/1000/60%60);
            var S = parseInt(time/1000%60);
            D = D<=9?"0"+ D : D;
            H = H<=9?"0"+ H : H;
            M = M<=9?"0"+ M : M;
            S = S<=9?"0"+ S : S;
            document.getElementById("Day").innerText = D;
            document.getElementById("Hour").innerText = H;
            document.getElementById("Minute").innerText = M;
            document.getElementById("Second").innerText = S;
        }
        setTimeout(countDown,1000);
    }
</script>
</body>
</html>
